<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var a = [1, 3, 6, 3, 23, 76, 1, 34, 222, 6, 456, 221];
    function maopao(arr) {
      const len = arr.length
      for(let i=1; i< len; i++) {
        for(let j=0; j< len-i; j++) {
          if(arr[j+1] < arr[j]){
            const temp = arr[j]
            arr[j] = arr[j+1]
            arr[j+1] = temp
          }
        }
      }
      return arr
    }
    console.log(maopao(a))
  </script>
</body>
</html>